home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / scn_savr / topsourc / frmmain.frm next >
Encoding:
Text File  |  1995-10-03  |  13.4 KB  |  470 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BorderStyle     =   0  'None
  4.    ClientHeight    =   5490
  5.    ClientLeft      =   1575
  6.    ClientTop       =   3465
  7.    ClientWidth     =   7350
  8.    ControlBox      =   0   'False
  9.    Height          =   5895
  10.    Icon            =   0
  11.    Left            =   1515
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5490
  16.    ScaleWidth      =   7350
  17.    Top             =   3120
  18.    Width           =   7470
  19.    WindowState     =   2  'Maximized
  20.    Begin PictureBox pTop 
  21.       AutoRedraw      =   -1  'True
  22.       BorderStyle     =   0  'None
  23.       Height          =   840
  24.       Index           =   0
  25.       Left            =   510
  26.       Picture         =   FRMMAIN.FRX:0000
  27.       ScaleHeight     =   840
  28.       ScaleWidth      =   900
  29.       TabIndex        =   19
  30.       Top             =   2190
  31.       Visible         =   0   'False
  32.       Width           =   900
  33.    End
  34.    Begin PictureBox pTop 
  35.       AutoRedraw      =   -1  'True
  36.       BorderStyle     =   0  'None
  37.       Height          =   840
  38.       Index           =   1
  39.       Left            =   1500
  40.       Picture         =   FRMMAIN.FRX:115A
  41.       ScaleHeight     =   840
  42.       ScaleWidth      =   900
  43.       TabIndex        =   18
  44.       Top             =   2190
  45.       Visible         =   0   'False
  46.       Width           =   900
  47.    End
  48.    Begin PictureBox pTop 
  49.       AutoRedraw      =   -1  'True
  50.       BorderStyle     =   0  'None
  51.       Height          =   840
  52.       Index           =   2
  53.       Left            =   2490
  54.       Picture         =   FRMMAIN.FRX:22B4
  55.       ScaleHeight     =   840
  56.       ScaleWidth      =   900
  57.       TabIndex        =   17
  58.       Top             =   2190
  59.       Visible         =   0   'False
  60.       Width           =   900
  61.    End
  62.    Begin PictureBox pTop 
  63.       AutoRedraw      =   -1  'True
  64.       BorderStyle     =   0  'None
  65.       Height          =   840
  66.       Index           =   3
  67.       Left            =   510
  68.       Picture         =   FRMMAIN.FRX:340E
  69.       ScaleHeight     =   840
  70.       ScaleWidth      =   900
  71.       TabIndex        =   16
  72.       Top             =   3120
  73.       Visible         =   0   'False
  74.       Width           =   900
  75.    End
  76.    Begin PictureBox pTop 
  77.       AutoRedraw      =   -1  'True
  78.       BorderStyle     =   0  'None
  79.       Height          =   840
  80.       Index           =   4
  81.       Left            =   1500
  82.       Picture         =   FRMMAIN.FRX:4568
  83.       ScaleHeight     =   840
  84.       ScaleWidth      =   900
  85.       TabIndex        =   15
  86.       Top             =   3120
  87.       Visible         =   0   'False
  88.       Width           =   900
  89.    End
  90.    Begin PictureBox pTop 
  91.       AutoRedraw      =   -1  'True
  92.       BorderStyle     =   0  'None
  93.       Height          =   840
  94.       Index           =   5
  95.       Left            =   2490
  96.       Picture         =   FRMMAIN.FRX:56C2
  97.       ScaleHeight     =   840
  98.       ScaleWidth      =   900
  99.       TabIndex        =   14
  100.       Top             =   3120
  101.       Visible         =   0   'False
  102.       Width           =   900
  103.    End
  104.    Begin PictureBox pTop 
  105.       AutoRedraw      =   -1  'True
  106.       BorderStyle     =   0  'None
  107.       Height          =   840
  108.       Index           =   6
  109.       Left            =   510
  110.       Picture         =   FRMMAIN.FRX:681C
  111.       ScaleHeight     =   840
  112.       ScaleWidth      =   900
  113.       TabIndex        =   13
  114.       Top             =   4050
  115.       Visible         =   0   'False
  116.       Width           =   900
  117.    End
  118.    Begin PictureBox pTop 
  119.       AutoRedraw      =   -1  'True
  120.       BorderStyle     =   0  'None
  121.       Height          =   840
  122.       Index           =   7
  123.       Left            =   1500
  124.       Picture         =   FRMMAIN.FRX:7976
  125.       ScaleHeight     =   840
  126.       ScaleWidth      =   900
  127.       TabIndex        =   12
  128.       Top             =   4050
  129.       Visible         =   0   'False
  130.       Width           =   900
  131.    End
  132.    Begin PictureBox pTop 
  133.       AutoRedraw      =   -1  'True
  134.       BorderStyle     =   0  'None
  135.       Height          =   840
  136.       Index           =   8
  137.       Left            =   2490
  138.       Picture         =   FRMMAIN.FRX:8AD0
  139.       ScaleHeight     =   840
  140.       ScaleWidth      =   900
  141.       TabIndex        =   11
  142.       Top             =   4050
  143.       Visible         =   0   'False
  144.       Width           =   900
  145.    End
  146.    Begin PictureBox pMask 
  147.       AutoRedraw      =   -1  'True
  148.       BorderStyle     =   0  'None
  149.       Height          =   840
  150.       Index           =   0
  151.       Left            =   3480
  152.       Picture         =   FRMMAIN.FRX:9C2A
  153.       ScaleHeight     =   840
  154.       ScaleWidth      =   900
  155.       TabIndex        =   10
  156.       Top             =   2190
  157.       Visible         =   0   'False
  158.       Width           =   900
  159.    End
  160.    Begin PictureBox pMask 
  161.       AutoRedraw      =   -1  'True
  162.       BorderStyle     =   0  'None
  163.       Height          =   840
  164.       Index           =   1
  165.       Left            =   4470
  166.       Picture         =   FRMMAIN.FRX:A9D4
  167.       ScaleHeight     =   840
  168.       ScaleWidth      =   900
  169.       TabIndex        =   9
  170.       Top             =   2190
  171.       Visible         =   0   'False
  172.       Width           =   900
  173.    End
  174.    Begin PictureBox pMask 
  175.       AutoRedraw      =   -1  'True
  176.       BorderStyle     =   0  'None
  177.       Height          =   840
  178.       Index           =   2
  179.       Left            =   5460
  180.       Picture         =   FRMMAIN.FRX:B77E
  181.       ScaleHeight     =   840
  182.       ScaleWidth      =   900
  183.       TabIndex        =   8
  184.       Top             =   2190
  185.       Visible         =   0   'False
  186.       Width           =   900
  187.    End
  188.    Begin PictureBox pMask 
  189.       AutoRedraw      =   -1  'True
  190.       BorderStyle     =   0  'None
  191.       Height          =   840
  192.       Index           =   3
  193.       Left            =   3480
  194.       Picture         =   FRMMAIN.FRX:C528
  195.       ScaleHeight     =   840
  196.       ScaleWidth      =   900
  197.       TabIndex        =   7
  198.       Top             =   3120
  199.       Visible         =   0   'False
  200.       Width           =   900
  201.    End
  202.    Begin PictureBox pMask 
  203.       AutoRedraw      =   -1  'True
  204.       BorderStyle     =   0  'None
  205.       Height          =   840
  206.       Index           =   4
  207.       Left            =   4470
  208.       Picture         =   FRMMAIN.FRX:D2D2
  209.       ScaleHeight     =   840
  210.       ScaleWidth      =   900
  211.       TabIndex        =   6
  212.       Top             =   3120
  213.       Visible         =   0   'False
  214.       Width           =   900
  215.    End
  216.    Begin PictureBox pMask 
  217.       AutoRedraw      =   -1  'True
  218.       BorderStyle     =   0  'None
  219.       Height          =   840
  220.       Index           =   5
  221.       Left            =   5460
  222.       Picture         =   FRMMAIN.FRX:E07C
  223.       ScaleHeight     =   840
  224.       ScaleWidth      =   900
  225.       TabIndex        =   5
  226.       Top             =   3120
  227.       Visible         =   0   'False
  228.       Width           =   900
  229.    End
  230.    Begin PictureBox pMask 
  231.       AutoRedraw      =   -1  'True
  232.       BorderStyle     =   0  'None
  233.       Height          =   840
  234.       Index           =   6
  235.       Left            =   3480
  236.       Picture         =   FRMMAIN.FRX:EE26
  237.       ScaleHeight     =   840
  238.       ScaleWidth      =   900
  239.       TabIndex        =   4
  240.       Top             =   4050
  241.       Visible         =   0   'False
  242.       Width           =   900
  243.    End
  244.    Begin PictureBox pMask 
  245.       AutoRedraw      =   -1  'True
  246.       BorderStyle     =   0  'None
  247.       Height          =   840
  248.       Index           =   7
  249.       Left            =   4470
  250.       Picture         =   FRMMAIN.FRX:FBD0
  251.       ScaleHeight     =   840
  252.       ScaleWidth      =   900
  253.       TabIndex        =   3
  254.       Top             =   4050
  255.       Visible         =   0   'False
  256.       Width           =   900
  257.    End
  258.    Begin PictureBox pMask 
  259.       AutoRedraw      =   -1  'True
  260.       BorderStyle     =   0  'None
  261.       Height          =   840
  262.       Index           =   8
  263.       Left            =   5460
  264.       Picture         =   FRMMAIN.FRX:1097A
  265.       ScaleHeight     =   840
  266.       ScaleWidth      =   900
  267.       TabIndex        =   2
  268.       Top             =   4050
  269.       Visible         =   0   'False
  270.       Width           =   900
  271.    End
  272.    Begin PictureBox pSave 
  273.       BorderStyle     =   0  'None
  274.       ClipControls    =   0   'False
  275.       Height          =   840
  276.       Left            =   0
  277.       ScaleHeight     =   840
  278.       ScaleWidth      =   900
  279.       TabIndex        =   1
  280.       Top             =   0
  281.       Visible         =   0   'False
  282.       Width           =   900
  283.    End
  284.    Begin Timer Timer1 
  285.       Interval        =   50
  286.       Left            =   5310
  287.       Top             =   150
  288.    End
  289.    Begin PictureBox picSaver 
  290.       AutoRedraw      =   -1  'True
  291.       ClipControls    =   0   'False
  292.       Height          =   1050
  293.       Left            =   2145
  294.       ScaleHeight     =   1020
  295.       ScaleWidth      =   2370
  296.       TabIndex        =   0
  297.       Top             =   855
  298.       Width           =   2400
  299.    End
  300. End
  301.  
  302. Sub Form_Load ()
  303.  
  304.     'This variable serves as a flag to avoid the screensaver
  305.     'from ending when the form paints.
  306.     'The paint event causes the mouse_move event if the
  307.     'mousepointer is on the form
  308.     firsttime% = True
  309.     
  310.     'Hide the mouse pointer
  311.     Res = ShowCursor(False)
  312.  
  313.     'make sure window is full screen
  314.     Me.WindowState = 2
  315.  
  316.     'Allow our temporary picture box to be drawn on
  317.     pSave.AutoRedraw = True
  318.  
  319. End Sub
  320.  
  321. Sub picSaver_Click ()
  322.  
  323.     ExitNice
  324.  
  325. End Sub
  326.  
  327. Sub picSaver_DblClick ()
  328.  
  329.     ExitNice
  330.  
  331. End Sub
  332.  
  333. Sub picSaver_KeyDown (KeyCode As Integer, Shift As Integer)
  334.  
  335.     ExitNice
  336.  
  337. End Sub
  338.  
  339. Sub picSaver_KeyPress (KeyAscii As Integer)
  340.  
  341.     ExitNice
  342.  
  343. End Sub
  344.  
  345. Sub picSaver_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  346.  
  347.     ExitNice
  348.  
  349. End Sub
  350.  
  351. Sub picSaver_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  352.  
  353.     Static OldX, OldY
  354.  
  355.     'We use this flag to make sure the screen saver
  356.     'doesn't end when the form initially paints itself,
  357.     'causing a Mouse_Move event
  358.     If firsttime% Then
  359.         OldX = X
  360.         OldY = Y
  361.         firsttime% = False
  362.     End If
  363.  
  364.     If OldX <> X Or OldY <> Y Then
  365.         ExitNice
  366.     End If
  367.  
  368. End Sub
  369.  
  370. Sub Timer1_Timer ()
  371.  
  372.     Dim dummy%
  373.  
  374.     Dim hDestDC%, nWidth%, nHeight%, hPicDC%, hMaskDC%, dwRop&
  375.     Dim hSaveDC%
  376.     
  377.     Static OldX%, OldY%, SkipX%, SkipY%
  378.     Static X%, Y%, reverseX%, reverseY%, captured%
  379.     
  380.     'Randomize the initial position so the top always
  381.     'starts at a different position
  382.     Randomize
  383.     If Not captured% Then
  384.         X% = Int(((Me.ScaleWidth + 1) * Rnd) / Screen.TwipsPerPixelX)
  385.         Y% = Int(((Me.ScaleHeight + 1) * Rnd) / Screen.TwipsPerPixelY)
  386.         OldX% = X%
  387.         OldY% = Y%
  388.     End If
  389.  
  390.     'Increment our picture and mask indexes
  391.     picCount% = picCount% + 1
  392.     
  393.     'If we've reached the last picture, restart
  394.     If picCount% = 9 Then picCount% = 0
  395.  
  396.     'Get handles for all picture boxes involved
  397.     hDestDC% = picSaver.hDC
  398.     hPicDC% = pTop(picCount%).hDC
  399.     hMaskDC% = pMask(picCount%).hDC
  400.     hSaveDC% = pSave.hDC
  401.     
  402.     nWidth% = pTop(picCount%).ScaleWidth / Screen.TwipsPerPixelX
  403.     nHeight% = pTop(picCount%).ScaleHeight / Screen.TwipsPerPixelY
  404.     
  405.     'I've used 120 steps for the top to cruise the entire
  406.     'screen. Less steps means faster.
  407.     SkipX% = picSaver.ScaleWidth / 120 / Screen.TwipsPerPixelX
  408.     SkipY% = picSaver.ScaleHeight / 120 / Screen.TwipsPerPixelY
  409.  
  410.     'Make sure we save the original screen's
  411.     'background in our provisional picture box
  412.     If Not captured% Then
  413.         dwRop& = SRCCOPY
  414.         dummy% = BitBlt%(hSaveDC%, 0, 0, nWidth%, nHeight%, hDestDC%, X%, Y%, dwRop&)
  415.         'We've saved it, so we may continue
  416.         captured% = True
  417.     End If
  418.  
  419.     'Restore the background to its original state (note the plus and minus 2
  420.     'offset used with OldX% and OldY%: this "bends" the screen)
  421.     dwRop& = SRCCOPY
  422.     dummy% = BitBlt%(hDestDC%, OldX% + 2, OldY% - 2, nWidth%, nHeight%, hSaveDC%, 0, 0, dwRop&)
  423.     
  424.     'Save the new position into the provisional picture
  425.     'box so we may restore it later with the previous step
  426.     dwRop& = SRCCOPY
  427.     dummy% = BitBlt%(hSaveDC%, 0, 0, nWidth%, nHeight%, hDestDC%, X%, Y%, dwRop&)
  428.     
  429.     'Copy (SRCAND) the mask into the new position
  430.     dwRop& = SRCAND
  431.     dummy% = BitBlt%(hDestDC%, X%, Y%, nWidth%, nHeight%, hMaskDC%, 0, 0, dwRop&)
  432.     
  433.     'Copy (SRCINVERT) then picture into the new position
  434.     dwRop& = SRCINVERT
  435.     dummy% = BitBlt%(hDestDC%, X%, Y%, nWidth%, nHeight%, hPicDC%, 0, 0, dwRop&)
  436.  
  437.     'Remember this position for next pass
  438.     OldX% = X%
  439.     OldY% = Y%
  440.  
  441.     'Have we reached the end of the screen?
  442.     If X% >= (picSaver.ScaleWidth - pSave.ScaleWidth) / Screen.TwipsPerPixelX Then
  443.         reverseX% = True
  444.     ElseIf X% <= 0 Then
  445.         reverseX% = False
  446.     End If
  447.     
  448.     'Have we reached the bottom of the screen?
  449.     If Y% >= (picSaver.ScaleHeight - pSave.ScaleHeight) / Screen.TwipsPerPixelY Then
  450.         reverseY% = True
  451.     ElseIf Y% <= 0 Then
  452.         reverseY% = False
  453.     End If
  454.     
  455.     'Get a new position
  456.     If reverseX% Then
  457.         X% = X% - SkipX%
  458.     Else
  459.         X% = X% + SkipX%
  460.     End If
  461.  
  462.     If reverseY% Then
  463.         Y% = Y% - SkipY%
  464.     Else
  465.         Y% = Y% + SkipY%
  466.     End If
  467.  
  468. End Sub
  469.  
  470.